From: Florian Müllner Date: Thu, 3 Feb 2022 00:57:46 +0000 (+0100) Subject: dbusServices: Allow replacement X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~530^2^2~109 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8d8eba000fa54865ba2635328b6aed8a151686a2;p=gnome-shell.git dbusServices: Allow replacement The REPLACE flag we currently pass is useless, as replacing the service is disallowed when not started with the ALLOW_REPLACEMENT flag. Fix this by adopting a more standard pattern where replacement is always allowed, but only actually requested when `--replace` is passed on the command line. Part-of: --- diff --git a/js/dbusServices/dbusService.js b/js/dbusServices/dbusService.js index 71b1e35d7..3e2fde06a 100644 --- a/js/dbusServices/dbusService.js +++ b/js/dbusServices/dbusService.js @@ -6,6 +6,8 @@ const Signals = imports.signals; const IDLE_SHUTDOWN_TIME = 2; // s +const { programArgs } = imports.system; + var ServiceImplementation = class { constructor(info, objectPath) { this._objectPath = objectPath; @@ -167,9 +169,13 @@ var DBusService = class { this._service.register(); + let flags = Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT; + if (programArgs.includes('--replace')) + flags |= Gio.BusNameOwnerFlags.REPLACE; + Gio.DBus.own_name(Gio.BusType.SESSION, this._name, - Gio.BusNameOwnerFlags.REPLACE, + flags, () => this._service.export(), null, () => this._loop.quit());